/*
 * @Description: 首页
 * @Author: iamsmiling
 * @Date: 2021-05-22 17:30:00
 * @LastEditTime: 2021-06-13 17:23:09
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/domain/local/bottom_navigation_bar_item_entity.dart';
import 'package:credit_business_circle/pages/community/community_page.dart';
import 'package:credit_business_circle/pages/home/home_page.dart';
import 'package:credit_business_circle/pages/message/message_page.dart';
import 'package:credit_business_circle/pages/mine/mine_page.dart';
import 'package:credit_business_circle/pages/publish_square/publish_square_page.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class MainController extends GetxController {
  List<BottomNavigationBarItemEntity> items = [];

  List<Widget> pages = [
    HomePage(),
    CommunityPage(),
    PublishSquarePage(),
    MessagePage(),
    MinePage(),
  ];

  int currentIndex = 0;

  switchTo(int index) {
    currentIndex = index;

    update();
  }

  void _initData() {
    items = [
      BottomNavigationBarItemEntity(icon: R.image.home, label: "首页"),
      BottomNavigationBarItemEntity(icon: R.image.community, label: "社群"),
      BottomNavigationBarItemEntity(icon: R.image.publish, label: ""),
      BottomNavigationBarItemEntity(icon: R.image.message, label: "消息"),
      BottomNavigationBarItemEntity(icon: R.image.mine, label: "我的")
    ];
  }

  @override
  void onInit() {
    _initData();
    super.onInit();
  }
}
